package com.tsmti.system.service.impl;

import com.tsmti.core.common.service.impl.BaseServiceImpl;
import com.tsmti.core.util.StringUtils;
import com.tsmti.system.entity.Message;
import com.tsmti.system.service.MessageService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Package：com.tsmti.lab.service.impl
 * @Class：MessageServiceImpl
 * @Description： TODO
 * @Author：xb
 * @Date：Created in 2018/7/26 10:01
 * @Company:
 * @Version：
 * @Modified By:
 */
@Service("messageService")
public class MessageServiceImpl extends BaseServiceImpl<Message> implements MessageService {

    @Override
    public List<Message> getByInspectionId(String inspectionId, String orgId) {
        if(StringUtils.isEmpty(orgId)){
            return findByHql(" from Message where remark = ? and status = 0", inspectionId);
        }
        return findByHql(" from Message where remark = ? and status = 0 and orgId = ?", inspectionId, orgId);
    }
}
